package com.dongdong.bookstore.module.pms.model;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.Version;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;

/**
 * <p>
 * 书籍
 * </p>
 *
 * @author chiangkai
 * @since 2021-11-07
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("book")
@ApiModel(value = "Book对象", description = "书籍 ")
public class Book implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotEmpty
    @ApiModelProperty(value = "书籍名称")
    private String name;

    @NotEmpty
    @ApiModelProperty(value = "书籍数量")
    private Integer count;

    @ApiModelProperty(value = "国际标准书号ISBN")
    private String isbn;

    @NotEmpty
    @ApiModelProperty(value = "价格")
    private BigDecimal price;

    @ApiModelProperty(value = "出版社")
    private String press;

    @ApiModelProperty(value = "图书规格")
    private String spec;

    @ApiModelProperty(value = "装订")
    private String binding;

    @ApiModelProperty(value = "印张")
    private Integer sheet;

    @ApiModelProperty(value = "字数")
    private String words;

    @ApiModelProperty(value = "版次")
    private String edition;

    @NotEmpty
    @Range(max = 1, message = "状态参数错误")
    @ApiModelProperty(value = "状态 1上架0下架")
    private Integer state;

    @ApiModelProperty(value = "推荐优先级")
    private Integer sort;

    @ApiModelProperty(value = "书籍表述")
    private String description;

    @ApiModelProperty(value = "作者")
    private String author;

    @ApiModelProperty(value = "科目ID")
    private Long subjectId;

    @ApiModelProperty(value = "分类ID")
    private Long categoryId;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @ApiModelProperty(value = "逻辑删除 1删除0未删除")
    @TableLogic
    private Integer deleted;

    @ApiModelProperty(value = "乐观锁")
    @Version
    private Integer version;


}
